﻿using System;

namespace ConsoleApp3
{
    //先声明一个委托
    public delegate void pushmessageDlg(string name);
    class Program
    {
        //声明一个事件
        public event pushmessageDlg sunscriptionevent;
        static void Main(string[] args)
        {
            pushmessageDlg push = pushmessage;
            push += Programe_sunscriptionevent;
            push("小明");
            push("小王");
        }
        private static void Programe_sunscriptionevent(string name)
        {
            Console.WriteLine($" {name} 订阅了事件");
        }
        public static void pushmessage(string name)
        {
            Console.WriteLine($"向 {name} 推送信息");
        }
    }
}
